home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- // Copyright (C) 1997-1998 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 17 December 1998
- // Original Author: jb
- // Rewritten by: stefand
- //
- // Procedure Name:
- // prefixHierarchy
- //
- // Description:
- // Brings up a prompt dialog to ask the user for a prefix
- // to add to the names of a complete hierarchy, starting at the
- // selected nodes, and traversing the transform nodes downwards.
- //
- // Note: this does no checking for 'illegal' characters! This
- // should be added.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
-
-
- // rename a transform node by giving it a prefix
- // recurses to all children
- proc prefixNode(string $prefix, string $node)
- {
- // check if it is a transform or derived from transform.
- // We don't rename shapes since they will likely be renamed
- // when we renamed their parent transform.
- //
- string $isType[] = `ls -type transform $node`;
- if (size($isType) > 0 ) {
-
- // extract the name of this node from its full path
- //
- string $nodeName = `substitute ".*|" $node ""`;
-
- // rename this node
- //
- string $newName = `rename $node ( $prefix + $nodeName )`;
- }
- }
-
-
- global proc prefixHierarchy( )
- {
- string $result = `promptDialog
- -title "Prefix Hierarchy"
- -message "Enter Prefix: "
- -text "prefix_"
- -button "OK"
- -button "Cancel"
- -defaultButton "OK"
- -cancelButton "Cancel"
- -dismissString "Cancel"`;
-
- // If the result was "OK", then proceed
- //
- if ( $result == "OK" ) {
-
- // Get the prefix the user entered
- //
- string $prefix = `promptDialog -q`;
-
- // Get a list of all descendents (The nodes are ordered from
- // leaf to root
- //
- string $currentNodes[] = eval("listRelatives -pa -ad `ls -sl -l`");
-
- // add the prefix to each descendent node
- //
- if ( size( $currentNodes ) > 0 ) {
- for( $i=0; $i < size( $currentNodes ); $i++ ) {
- prefixNode( $prefix, $currentNodes[$i] );
- }
- }
-
- // get a list of nodes on the list
- $currentNodes = `ls -sl -l`;
-
- // add the prefix to each node on the active list
- //
- if ( size( $currentNodes ) > 0 ) {
- for( $i=0; $i < size( $currentNodes ); $i++ ) {
- prefixNode( $prefix, $currentNodes[$i] );
- }
- }
- }
- }
-
-